package com.campus.dao.impl;

import com.campus.dao.CourseDao;
import com.campus.model.Course;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
@Slf4j
public class CourseDaoImpl implements CourseDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Override
    public Integer addCourse(Course course) {
        String sql = " INSERT INTO t_course (course_name,created_time,status,activity_id,teacher_id,class_id) VALUES(?,?,?,?,?,?)";
        Object[] args = new Object[]{
                course.getCourse_name(),
                course.getCreated_time(),
                course.getStatus(),
                course.getActivity_id(),
                course.getTeacher_id(),
                course.getClass_id(),
        };
        return jdbcTemplate.update(sql,args);
    }
}
